
/******************************************************************************\
|    Title:        	 TABLE E8: Event History Analysis					       |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000

use congress_yearly.dta, clear
xtset stafferid year

*******************************************
** 2008-2016

xtreg lobbydirectafter switchtouncovered_treatment daysworked  committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.experience_imp i.year if posttreat==1, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model1
estadd local fixed "Yes" , replace

*******************************************
** 2007-2016

xtreg lobbydirectafter switchtouncovered_treatment daysworked  committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear ///
	dcoffice_everyear leaderofficestaff_everyear i.experience_imp i.year if posttreat==1 | year==2007, fe nonest cluster(stafferid)
summarize lobbydirectafter if e(sample)==1
estadd scalar ymean = r(mean) 
est store model2
estadd local fixed "Yes" , replace
	
	

esttab model* using "TABLED8.csv", replace ///
	b(3) se(3) star(* .05 ** .01 *** 0.001) ///
	stats(fixed ymean N N_g r2, fmt(0 3 0 0 3) labels("Staffer FE" "Mean of DV"  "Observations" "Number of staffers" "R2"))  ///
	nomtitles mgroups("2001-2007" "2001-2006", pattern(1 1)) ///
	coeflabels(switchtouncovered_treatment "Switch to uncovered" daysworked "Days worked" experience_imp "Hill experience" experience_sq "Hill experience sq." committeestaff2_everyear "Committee staff" personalstaff_everyear "Personal staff" senate_everyear "Senate staff" majority_everyear "Majority party staff" minority_everyear "Minority party staff" dcoffice_everyear "DC office staff" leaderofficestaff_everyear "Leadership office staff") ///
    label parentheses nogaps nolines noeqlines ///
    noomitted nodepvars nobaselevels indicate("Year FE = *.year" "Duration FE = *.experience_imp") nonotes noconstant
